package Easy.BitOperation;

/**
 * @author: white-zhou
 * @date: 2024-09-18 18:19
 **/
public class HammingDistance {
    public int hammingDistance(int x, int y) {
        int xor = x ^ y;
        int res = 0;
        while (xor != 0) {
            res += xor & 1;
            xor >>= 1;
        }
        return res;
    }
}
